<template>
  <div class="dev">
    <div class="title">
      <el-button type="primary" @click="$router.push('/sys/tenant')">返回</el-button>
    </div>

    <el-carousel ref="carousel" height="670px" :autoplay="false" arrow="never" :initial-index="active"
      indicator-position="none">
      <!-- 租户域名 -->
      <el-carousel-item>
        <el-card class="box-card">
          <div slot="header" class="clearfix">
            <b>租户配置</b>
          </div>
          <div class="text item apl">
            <el-form ref="one" :model="yuName" label-width="80px" :rules="rules">
              <el-form-item label="租户名称" prop="name">
                <el-input clearable v-model="yuName.name" placeholder="请输入租户名称"></el-input>
              </el-form-item>
              <el-form-item label="租户域名" prop="yName">
                <el-input clearable v-model="yuName.yName" placeholder="请输入租户域名"></el-input>
              </el-form-item>
            </el-form>
          </div>
        </el-card>
      </el-carousel-item>
      <!-- 微信部分 -->
      <el-carousel-item>
        <div class="wx">
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <b>微信小程序参数</b>
            </div>
            <div class="text item">
              <el-form ref="two" :model="wxMini" label-width="80px" :rules="rules2">
                <el-form-item label="appid" prop="wxMiniAppid">
                  <el-input clearable v-model="wxMini.wxMiniAppid" placeholder="请输入appid"></el-input>
                </el-form-item>
                <el-form-item label="secret" prop="wxMiniSecret">
                  <el-input clearable v-model="wxMini.wxMiniSecret" placeholder="请输入secret"></el-input>
                </el-form-item>
              </el-form>
            </div>
          </el-card>
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <b>微信公众号参数</b>
            </div>
            <div class="text item">
              <el-form ref="two" :model="wxMini" label-width="150px" :rules="rules2">
                <el-form-item label="appid" prop="wxPubAppid">
                  <el-input clearable v-model="wxMini.wxPubAppid" placeholder="请输入appid"></el-input>
                </el-form-item>
                <el-form-item prop="wxPubSecret" label="secret">
                  <el-input clearable v-model="wxMini.wxPubSecret" placeholder="请输入secret"></el-input>
                </el-form-item>
                <el-form-item prop="wxMpLowBatMsgT" label="低电量提醒模板">
                  <el-input clearable v-model="wxMini.wxMpLowBatMsgT" placeholder="请输入低电量提醒模板"></el-input>
                </el-form-item>
                <el-form-item prop="wxMpChargeMsgT" label="充值提醒模板">
                  <el-input clearable v-model="wxMini.wxMpChargeMsgT" placeholder="请输入充值提醒模板"></el-input>
                </el-form-item>
                <el-form-item prop="wxMpLongTimeMsgT" label="未充值提醒模板">
                  <el-input clearable v-model="wxMini.wxMpLongTimeMsgT" placeholder="请输入长时间未充值提醒模板"></el-input>
                </el-form-item>
                <el-form-item prop="wxMpMinusMsgT" label="负电量提醒模板">
                  <el-input clearable v-model="wxMini.wxMpMinusMsgT" placeholder="请输入负电量提醒模板"></el-input>
                </el-form-item>
                <el-form-item prop="token" label="token">
                  <el-input clearable v-model="wxMini.token" placeholder="请输入token"></el-input>
                </el-form-item>
                <el-form-item prop="aesKey" label="aesKey">
                  <el-input clearable v-model="wxMini.aesKey" placeholder="请输入aesKey"></el-input>
                </el-form-item>
              </el-form>
            </div>
          </el-card>
        </div>
      </el-carousel-item>
      <!-- 支付宝部分 -->
      <el-carousel-item>
        <el-card class="box-card">
          <div slot="header" class="clearfix">
            <b>支付宝小程序参数</b>
          </div>
          <div class="text item apl">
            <el-form ref="four" :model="apMini" label-width="120px" :rules="rules3">
              <el-form-item prop="appid" label="appid">
                <el-input clearable v-model="apMini.appid" placeholder="请输入appid"></el-input>
              </el-form-item>
              <el-form-item prop="aesKey" label="aesKey">
                <el-input clearable v-model="apMini.aesKey" placeholder="请输入aesKey"></el-input>
              </el-form-item>
              <el-form-item prop="privateKey" label="私钥">
                <el-input clearable type="textarea" :rows="6" v-model="apMini.privateKey" placeholder="请输入私钥"></el-input>
              </el-form-item>
              <el-form-item prop="publicKey" label="公钥">
                <el-input clearable type="textarea" :rows="6" v-model="apMini.publicKey" placeholder="请输入公钥"></el-input>
              </el-form-item>
              <el-form-item prop="publicAppKey" label="应用公钥">
                <el-input clearable type="textarea" :rows="6" v-model="apMini.publicAppKey"
                  placeholder="请输入应用公钥"></el-input>
              </el-form-item>
            </el-form>
          </div>
        </el-card>
      </el-carousel-item>
      <!-- 汇付 -->
      <el-carousel-item>
        <el-card class="box-card">
          <div slot="header" class="clearfix">
            <b>汇付配置</b>
          </div>
          <div class="text item apl">
            <el-form ref="four" :model="huifu" label-width="120px" :rules="rules4">
              <el-form-item prop="huifuType" label="汇付主体">
                <el-select v-model="huifu.huifuType" placeholder="请选择汇付主体">
                  <el-option v-for="item in huifuTypeList" :key="item.value" :label="item.label" :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item prop="huifuDgProductId" label="斗拱产品Id" v-if="huifu.huifuType == 1">
                <el-input clearable v-model="huifu.huifuDgProductId" placeholder="请输入斗拱产品Id"></el-input>
              </el-form-item>
              <el-form-item prop="huifuDgPrivateKey" label="斗拱商户私钥" v-if="huifu.huifuType == 1">
                <el-input clearable type="textarea" :rows="6" v-model="huifu.huifuDgPrivateKey"
                  placeholder="请输入斗拱商户私钥"></el-input>
              </el-form-item>
              <el-form-item prop="huifuDgPublicKey" label="斗拱应用公钥" v-if="huifu.huifuType == 1">
                <el-input clearable type="textarea" :rows="6" v-model="huifu.huifuDgPublicKey"
                  placeholder="请输入斗拱应用公钥"></el-input>
              </el-form-item>
              <el-form-item prop="huifuDgSysId" label="斗拱商户Id" v-if="huifu.huifuType == 1">
                <el-input clearable v-model="huifu.huifuDgSysId" placeholder="请输入斗拱商户Id"></el-input>
              </el-form-item>

              <el-form-item prop="huifuAdapayAppId" label="AdaPayId" v-if="huifu.huifuType == 2">
                <el-input clearable v-model="huifu.huifuAdapayAppId" placeholder="请输入AdaPayId"></el-input>
              </el-form-item>
              <el-form-item prop="huifuAdapayMockApiKey" label="mock模式key" v-if="huifu.huifuType == 2">
                <el-input clearable v-model="huifu.huifuAdapayMockApiKey" placeholder="请输入AdaPay的mock模式key"></el-input>
              </el-form-item>
              <el-form-item prop="huifuAdapayProdApiKey" label="prod模式key" v-if="huifu.huifuType == 2">
                <el-input clearable v-model="huifu.huifuAdapayProdApiKey" placeholder="请输入AdaPay的prod模式key"></el-input>
              </el-form-item>
              <el-form-item prop="huifuAdapayRsaPrivateKey" label="RSA私钥" v-if="huifu.huifuType == 2">
                <el-input clearable type="textarea" :rows="6" v-model="huifu.huifuAdapayRsaPrivateKey"
                  placeholder="请输入RSA私钥"></el-input>
              </el-form-item>
              <el-form-item prop="huifuAdapayRsaPublicKey" label="RSA公钥" v-if="huifu.huifuType == 2">
                <el-input clearable type="textarea" :rows="6" v-model="huifu.huifuAdapayRsaPublicKey"
                  placeholder="请输入RSA公钥"></el-input>
              </el-form-item>
              <el-form-item prop="huifuAdapayRsaTenantPublicKey" label="商家公钥" v-if="huifu.huifuType == 2">
                <el-input clearable type="textarea" :rows="6" v-model="huifu.huifuAdapayRsaTenantPublicKey"
                  placeholder="请输入商家公钥"></el-input>
              </el-form-item>
            </el-form>
          </div>
        </el-card>
      </el-carousel-item>
      <!-- 阿里云部分 -->
      <el-carousel-item class="aliyun">
        <el-card class="box-card">
          <div slot="header" class="clearfix">
            <b>阿里云短信模板</b>
          </div>
          <div class="text item apl">
            <el-form class="ali" label-position="top" ref="five" :model="aliMsg" :rules="rules5">
              <el-form-item prop="aliMsgUrl" label="阿里云域名">
                <el-input clearable v-model="aliMsg.aliMsgUrl" placeholder="请输入阿里云aliMsgUrl"></el-input>
              </el-form-item>
              <el-form-item prop="aliMsgAccessKeyId" label="阿里云aliMsgAccessKeyId">
                <el-input clearable v-model="aliMsg.aliMsgAccessKeyId" placeholder="请输入阿里云aliMsgAccessKeyId"></el-input>
              </el-form-item>
              <el-form-item prop="aliMsgBindCardT" label="绑定银行卡短信模板">
                <el-input clearable v-model="aliMsg.aliMsgBindCardT" placeholder="请输入绑定银行卡短信模板"></el-input>
              </el-form-item>
              <el-form-item prop="aliSignName" label="签名">
                <el-input clearable v-model="aliMsg.aliSignName" placeholder="请输入签名"></el-input>
              </el-form-item>
              <el-form-item prop="aliMsgChangeCardT" label="更换银行卡短信模板">
                <el-input clearable v-model="aliMsg.aliMsgChangeCardT" placeholder="请输入更换银行卡短信模板"></el-input>
              </el-form-item>
              <el-form-item prop="aliMsgDeleteCardT" label="删除银行卡短信模板">
                <el-input clearable v-model="aliMsg.aliMsgDeleteCardT" placeholder="请输入删除银行卡模板"></el-input>
              </el-form-item>
              <el-form-item prop="aliMsgRegisterT" label="阿里云注册模板">
                <el-input clearable v-model="aliMsg.aliMsgRegisterT" placeholder="请输入阿里云注册模板"></el-input>
              </el-form-item>
              <el-form-item prop="aliMsgForgetPasswordT" label="阿里云忘记密码模板">
                <el-input clearable v-model="aliMsg.aliMsgForgetPasswordT" placeholder="请输入阿里云忘记密码模板"></el-input>
              </el-form-item>
              <el-form-item prop="aliMsgChangeOldUserT" label="阿里云旧手机号模板">
                <el-input clearable v-model="aliMsg.aliMsgChangeOldUserT" placeholder="请输入阿里云旧手机号模板"></el-input>
              </el-form-item>
              <el-form-item prop="aliMsgChangeNewUserT" label="阿里云新手机号模板">
                <el-input clearable v-model="aliMsg.aliMsgChangeNewUserT" placeholder="请输入阿里云新手机号模板"></el-input>
              </el-form-item>
              <el-form-item prop="aliMsgVirtualT" label="租币短信模板">
                <el-input clearable v-model="aliMsg.aliMsgVirtualT" placeholder="请输入租币短信模板"></el-input>
              </el-form-item>
              <el-form-item prop="aliMsgAccessKeySecret" label="阿里云accessKeySecret">
                <el-input clearable type="textarea" :rows="6" v-model="aliMsg.aliMsgAccessKeySecret"
                  placeholder="请输入阿里云accessKeySecret"></el-input>
              </el-form-item>
            </el-form>
          </div>
        </el-card>
      </el-carousel-item>
    </el-carousel>

    <div class="step">
      <el-steps :space="200" :active="successActive" :finish-status="finish" align-center>
        <el-step title="租户配置"></el-step>
        <el-step title="微信小程序配置"></el-step>
        <el-step title="支付宝小程序配置"></el-step>
        <el-step title="汇付配置"></el-step>
        <el-step title="阿里云短信模板"></el-step>
      </el-steps>
      <div class="btn">
        <el-button type="primary" v-if="active > 0" @click="last">上一步</el-button>
        <el-button type="primary" v-if="active < 4" @click="next">下一步</el-button>
        <el-button v-if="active == 4" :key="1" type="success" :disabled="successActive == 5 ? false : true"
          @click="subMit">添加</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import { postTenantApi, postTenantApApi } from "../../../api/system/tenant";
export default {
  data() {
    return {
      finish: "success",
      successActive: 0,
      active: 0,
      yuName: {
        name: "",
        yName: "",
      },
      wxMini: {
        wxMiniAppid: "",
        wxMiniSecret: "",
        token: "",
        aesKey: "",
        wxPubAppid: "",
        wxMpLowBatMsgT: "",
        wxMpChargeMsgT: "",
        wxPubSecret: "",
        wxMpLongTimeMsgT: "",
        wxMpMinusMsgT: "",
      },
      apMini: {
        appid: "",
        privateKey: "",
        publicKey: "",
        publicAppKey: "",
        aesKey: "",
      },
      aliMsg: {
        aliMsgUrl: "",
        aliMsgAccessKeyId: "",
        aliMsgAccessKeySecret: "",
        aliMsgBindCardT: "",
        aliMsgChangeCardT: "",
        aliMsgDeleteCardT: "",
        aliMsgRegisterT: "",
        aliMsgForgetPasswordT: "",
        aliMsgChangeOldUserT: "",
        aliMsgChangeNewUserT: "",
        aliMsgVirtualT: "",
        aliSignName: "",
      },
      huifu: {
        huifuType: 1,
        huifuDgSysId: "",
        huifuDgProductId: "",
        huifuDgPrivateKey: "",
        huifuDgPublicKey: "",
        huifuAdapayAppId: "",
        huifuAdapayMockApiKey: "",
        huifuAdapayProdApiKey: "",
        huifuAdapayRsaPrivateKey: "",
        huifuAdapayRsaPublicKey: "",
        huifuAdapayRsaTenantPublicKey: "",
      },
      huifuTypeList: [
        {
          label: "斗拱",
          value: 1,
        },
        {
          label: "AdaPay",
          value: 2,
        },
      ],
      rules: {
        name: {
          required: true,
          message: "租户名称不能为空",
          trigger: ["blur", "change"],
        },
        yName: {
          required: true,
          message: "域名不能为空",
          trigger: ["blur", "change"],
        },
      },
      rules2: {
        wxMpLowBatMsgT: {
          required: true,
          message: "wxMpLoWBatMsgT不能为空",
          trigger: ["blur", "change"],
        },
        wxMpLongTimeMsgT: {
          required: true,
          message: "wxMpLongTimeMsgT不能为空",
          trigger: ["blur", "change"],
        },
        wxMpMinusMsgT: {
          required: true,
          message: "wxMpMinusMsgT不能为空",
          trigger: ["blur", "change"],
        },
        wxMpChargeMsgT: {
          required: true,
          message: "wxMpChargeMsgT不能为空",
          trigger: ["blur", "change"],
        },
        wxMiniAppid: {
          required: true,
          message: "appid不能为空",
          trigger: ["blur", "change"],
        },
        wxMiniSecret: {
          required: true,
          message: "secret不能为空",
          trigger: ["blur", "change"],
        },
        wxPubAppid: {
          required: true,
          message: "appid不能为空",
          trigger: ["blur", "change"],
        },
        wxPubSecret: {
          required: true,
          message: "secret不能为空",
          trigger: ["blur", "change"],
        },
        token: {
          required: true,
          message: "token不能为空",
          trigger: ["blur", "change"],
        },
        aesKey: {
          required: true,
          message: "aesKey不能为空",
          trigger: ["blur", "change"],
        },
      },
      rules3: {
        appid: {
          required: true,
          message: "appid不能为空",
          trigger: ["blur", "change"],
        },
        privateKey: {
          required: true,
          message: "privateKey不能为空",
          trigger: ["blur", "change"],
        },
        publicKey: {
          required: true,
          message: "publicKey不能为空",
          trigger: ["blur", "change"],
        },
        publicAppKey: {
          required: true,
          message: "publicAppKey不能为空",
          trigger: ["blur", "change"],
        },
        aesKey: {
          required: true,
          message: "aesKey不能为空",
          trigger: ["blur", "change"],
        },
      },
      rules4: {
        huifuType: {
          required: true,
          message: "huifuType不能为空",
          trigger: ["blur", "change"],
        },
        huifuDgSysId: {
          required: true,
          message: "huifuDgSysId不能为空",
          trigger: ["blur", "change"],
        },
        huifuDgProductId: {
          required: true,
          message: "huifuDgProductId不能为空",
          trigger: ["blur", "change"],
        },
        huifuDgPrivateKey: {
          required: true,
          message: "huifuDgPrivateKey不能为空",
          trigger: ["blur", "change"],
        },
        huifuDgPublicKey: {
          required: true,
          message: "huifuDgPublicKey不能为空",
          trigger: ["blur", "change"],
        },
        huifuAdapayAppId: {
          required: true,
          message: "huifuAdapayAppId不能为空",
          trigger: ["blur", "change"],
        },
        huifuAdapayMockApiKey: {
          required: true,
          message: "huifuAdapayMockApiKey不能为空",
          trigger: ["blur", "change"],
        },
        huifuAdapayProdApiKey: {
          required: true,
          message: "huifuAdapayProdApiKey不能为空",
          trigger: ["blur", "change"],
        },
        huifuAdapayRsaPrivateKey: {
          required: true,
          message: "huifuAdapayRsaPrivateKey不能为空",
          trigger: ["blur", "change"],
        },
        huifuAdapayRsaPublicKey: {
          required: true,
          message: "huifuAdapayRsaPublicKey不能为空",
          trigger: ["blur", "change"],
        },
        huifuAdapayRsaTenantPublicKey: {
          required: true,
          message: "huifuAdapayRsaTenantPublicKey不能为空",
          trigger: ["blur", "change"],
        },
      },
      rules5: {
        aliSignName: {
          required: true,
          message: "aliSignName不能为空",
          trigger: ["blur", "change"],
        },
        aliMsgAccessKeyId: {
          required: true,
          message: "aliMsgAccessKeyId不能为空",
          trigger: ["blur", "change"],
        },
        aliMsgUrl: {
          required: true,
          message: "aliMsgUrl不能为空",
          trigger: ["blur", "change"],
        },
        aliMsgAccessKeySecret: {
          required: true,
          message: "aliMsgAccessKeySecret不能为空",
          trigger: ["blur", "change"],
        },
        aliMsgBindCardT: {
          required: true,
          message: "aliMsgBindCardT不能为空",
          trigger: ["blur", "change"],
        },
        aliMsgChangeCardT: {
          required: true,
          message: "aliMsgChangeCardT不能为空",
          trigger: ["blur", "change"],
        },
        aliMsgDeleteCardT: {
          required: true,
          message: "aliMsgDeleteCardT不能为空",
          trigger: ["blur", "change"],
        },
        aliMsgRegisterT: {
          required: true,
          message: "aliMsgRegisterT不能为空",
          trigger: ["blur", "change"],
        },
        aliMsgForgetPasswordT: {
          required: true,
          message: "aliMsgForgetPasswordT不能为空",
          trigger: ["blur", "change"],
        },
        aliMsgChangeOldUserT: {
          required: true,
          message: "aliMsgChangeOldUserT不能为空",
          trigger: ["blur", "change"],
        },
        aliMsgChangeNewUserT: {
          required: true,
          message: "aliMsgChangeNewUserT不能为空",
          trigger: ["blur", "change"],
        },
        aliMsgVirtualT: {
          required: true,
          message: "aliMsgVirtualT不能为空",
          trigger: ["blur", "change"],
        },
      },
    };
  },
  watch: {
    aliMsg: {
      immediate: true, // 立即执行
      deep: true, // 深度监听复杂类型内变化
      handler(newVal, oldVal) {
        this.rule();
      },
    },
  },
  methods: {
    rule() {
      if (this.yuName.name && this.yuName.yName) {
        this.successActive = 1;
      } else {
        this.successActive = 0;
      }
      if (
        this.yuName.name &&
        this.yuName.yName &&
        this.wxMini.wxMiniAppid &&
        this.wxMini.wxMiniSecret &&
        this.wxMini.token &&
        this.wxMini.aesKey &&
        this.wxMini.wxMpLowBatMsgT &&
        this.wxMini.wxMpChargeMsgT &&
        this.wxMini.wxPubAppid &&
        this.wxMini.wxPubSecret &&
        this.wxMini.wxMpLongTimeMsgT &&
        this.wxMini.wxMpMinusMsgT
      ) {
        this.successActive = 2;
      }
      if (
        this.yuName.name &&
        this.yuName.yName &&
        this.wxMini.wxMiniAppid &&
        this.wxMini.wxMiniSecret &&
        this.wxMini.token &&
        this.wxMini.aesKey &&
        this.wxMini.wxMpLowBatMsgT &&
        this.wxMini.wxMpChargeMsgT &&
        this.wxMini.wxPubAppid &&
        this.wxMini.wxPubSecret &&
        this.wxMini.wxMpLongTimeMsgT &&
        this.wxMini.wxMpMinusMsgT &&
        this.apMini.appid &&
        this.apMini.privateKey &&
        this.apMini.publicKey &&
        this.apMini.publicAppKey &&
        this.apMini.aesKey
      ) {
        this.successActive = 3;
      }
      if (
        this.yuName.name &&
        this.yuName.yName &&
        this.wxMini.wxMiniAppid &&
        this.wxMini.wxMiniSecret &&
        this.wxMini.wxMpLowBatMsgT &&
        this.wxMini.wxMpChargeMsgT &&
        this.wxMini.token &&
        this.wxMini.aesKey &&
        this.wxMini.wxPubAppid &&
        this.wxMini.wxPubSecret &&
        this.wxMini.wxMpLongTimeMsgT &&
        this.wxMini.wxMpMinusMsgT &&
        this.apMini.appid &&
        this.apMini.privateKey &&
        this.apMini.publicKey &&
        this.apMini.publicAppKey &&
        this.apMini.aesKey &&
        this.huifu.huifuType &&
        this.huifu.huifuDgSysId &&
        this.huifu.huifuDgProductId &&
        this.huifu.huifuDgPrivateKey &&
        this.huifu.huifuDgPublicKey
      ) {
        this.successActive = 4;
      }
      if (
        this.yuName.name &&
        this.yuName.yName &&
        this.wxMini.wxMiniAppid &&
        this.wxMini.wxMiniSecret &&
        this.wxMini.wxMpLowBatMsgT &&
        this.wxMini.wxMpChargeMsgT &&
        this.wxMini.token &&
        this.wxMini.aesKey &&
        this.wxMini.wxPubAppid &&
        this.wxMini.wxPubSecret &&
        this.wxMini.wxMpLongTimeMsgT &&
        this.wxMini.wxMpMinusMsgT &&
        this.apMini.appid &&
        this.apMini.privateKey &&
        this.apMini.publicKey &&
        this.apMini.publicAppKey &&
        this.apMini.aesKey &&
        this.huifu.huifuType &&
        this.huifu.huifuAdapayAppId &&
        this.huifu.huifuAdapayMockApiKey &&
        this.huifu.huifuAdapayProdApiKey &&
        this.huifu.huifuAdapayRsaPrivateKey &&
        this.huifu.huifuAdapayRsaPublicKey &&
        this.huifu.huifuAdapayRsaTenantPublicKey
      ) {
        this.successActive = 4;
      }
      if (
        this.yuName.name &&
        this.yuName.yName &&
        this.wxMini.wxMiniAppid &&
        this.wxMini.wxMiniSecret &&
        this.wxMini.wxMpLowBatMsgT &&
        this.wxMini.wxMpChargeMsgT &&
        this.wxMini.token &&
        this.wxMini.aesKey &&
        this.wxMini.wxPubAppid &&
        this.wxMini.wxPubSecret &&
        this.wxMini.wxMpLongTimeMsgT &&
        this.wxMini.wxMpMinusMsgT &&
        this.apMini.appid &&
        this.apMini.privateKey &&
        this.apMini.publicKey &&
        this.apMini.publicAppKey &&
        this.apMini.aesKey &&
        this.huifu.huifuType &&
        this.huifu.huifuDgSysId &&
        this.huifu.huifuDgProductId &&
        this.huifu.huifuDgPrivateKey &&
        this.huifu.huifuDgPublicKey &&
        this.aliMsg.aliMsgAccessKeyId &&
        this.aliMsg.aliMsgAccessKeySecret &&
        this.aliMsg.aliMsgBindCardT &&
        this.aliMsg.aliMsgChangeCardT &&
        this.aliMsg.aliMsgDeleteCardT &&
        this.aliMsg.aliMsgRegisterT &&
        this.aliMsg.aliMsgForgetPasswordT &&
        this.aliMsg.aliMsgChangeOldUserT &&
        this.aliMsg.aliMsgChangeNewUserT &&
        this.aliMsg.aliMsgVirtualT &&
        this.aliMsg.aliMsgUrl &&
        this.aliMsg.aliSignName
      ) {
        this.successActive = 5;
      }
      if (
        this.yuName.name &&
        this.yuName.yName &&
        this.wxMini.wxMiniAppid &&
        this.wxMini.wxMpLowBatMsgT &&
        this.wxMini.wxMpChargeMsgT &&
        this.wxMini.wxMiniSecret &&
        this.wxMini.token &&
        this.wxMini.aesKey &&
        this.wxMini.wxPubAppid &&
        this.wxMini.wxPubSecret &&
        this.wxMini.wxMpLongTimeMsgT &&
        this.wxMini.wxMpMinusMsgT &&
        this.apMini.appid &&
        this.apMini.privateKey &&
        this.apMini.publicKey &&
        this.apMini.publicAppKey &&
        this.apMini.aesKey &&
        this.huifu.huifuType &&
        this.huifu.huifuAdapayAppId &&
        this.huifu.huifuAdapayMockApiKey &&
        this.huifu.huifuAdapayProdApiKey &&
        this.huifu.huifuAdapayRsaPrivateKey &&
        this.huifu.huifuAdapayRsaPublicKey &&
        this.huifu.huifuAdapayRsaTenantPublicKey &&
        this.aliMsg.aliMsgAccessKeyId &&
        this.aliMsg.aliMsgAccessKeySecret &&
        this.aliMsg.aliMsgBindCardT &&
        this.aliMsg.aliMsgChangeCardT &&
        this.aliMsg.aliMsgDeleteCardT &&
        this.aliMsg.aliMsgRegisterT &&
        this.aliMsg.aliMsgForgetPasswordT &&
        this.aliMsg.aliMsgChangeOldUserT &&
        this.aliMsg.aliMsgChangeNewUserT &&
        this.aliMsg.aliMsgVirtualT &&
        this.aliMsg.aliMsgUrl &&
        this.aliMsg.aliSignName
      ) {
        this.successActive = 5;
      }
    },
    last() {
      this.active = this.active - 1;
      this.$refs.carousel.prev();
      this.rule();
    },
    next() {
      this.active = this.active + 1;
      this.$refs.carousel.next();
      this.rule();
      console.log(this.successActive);
    },
    subMit() {
      let that = this;
      let arr;
      if (this.huifu.huifuType == 1) {
        arr = {
          tenantName: this.yuName.name,
          url: this.yuName.yName,
          wxXcxAppId: this.wxMini.wxMiniAppid,
          wxXcxSecret: this.wxMini.wxMiniSecret,
          wxMpSecret: this.wxMini.wxPubSecret,
          wxMpAppId: this.wxMini.wxPubAppid,
          wxMpToken: this.wxMini.token,
          wxMpLowBatMsgT: this.wxMini.wxMpLowBatMsgT,
          wxMpChargeMsgT: this.wxMini.wxMpChargeMsgT,
          wxMpAesKey: this.wxMini.aesKey,
          wxMpLongTimeMsgT: this.wxMini.wxMpLongTimeMsgT,
          wxMpMinusMsgT: this.wxMini.wxMpMinusMsgT,
          aliAppId: this.apMini.appid,
          aliPrivateKey: this.apMini.privateKey,
          aliPublicKey: this.apMini.publicKey,
          aliPublicAppKey: this.apMini.publicAppKey,
          aliAesKey: this.apMini.aesKey,
          huifuDgSysId: this.huifu.huifuDgSysId,
          huifuDgProductId: this.huifu.huifuDgProductId,
          huifuDgPrivateKey: this.huifu.huifuDgPrivateKey,
          huifuDgPublicKey: this.huifu.huifuDgPublicKey,
          aliMsgAccessKeyId: this.aliMsg.aliMsgAccessKeyId,
          aliMsgAccessKeySecret: this.aliMsg.aliMsgAccessKeySecret,
          aliMsgBindCardT: this.aliMsg.aliMsgBindCardT,
          aliMsgChangeCardT: this.aliMsg.aliMsgChangeCardT,
          aliMsgDeleteCardT: this.aliMsg.aliMsgDeleteCardT,
          aliMsgRegisterT: this.aliMsg.aliMsgRegisterT,
          aliMsgForgetPasswordT: this.aliMsg.aliMsgForgetPasswordT,
          aliMsgChangeOldUserT: this.aliMsg.aliMsgChangeOldUserT,
          aliMsgChangeNewUserT: this.aliMsg.aliMsgChangeNewUserT,
          aliMsgVirtualT: this.aliMsg.aliMsgVirtualT,
          aliMsgUrl: this.aliMsg.aliMsgUrl,
          aliSignName: this.aliMsg.aliSignName,
        };
        postTenantApi(arr).then((res) => {
          if (res.code == 200) {
            that.$message.success("添加成功!");
            that.yuName = {
              name: "",
              yName: "",
            };
            that.wxMini = {
              wxMiniAppid: "",
              wxMiniSecret: "",
              token: "",
              wxMpLowBatMsgT: "",
              wxMpChargeMsgT: "",
              aesKey: "",
              wxPubAppid: "",
              wxPubSecret: "",
              wxMpLongTimeMsgT: "",
              wxMpMinusMsgT: "",
            };
            that.apMini = {
              appid: "",
              privateKey: "",
              publicKey: "",
              publicAppKey: "",
              aesKey: "",
            };
            that.huifu = {
              huifuType: 1,
              huifuDgSysId: "",
              huifuDgProductId: "",
              huifuDgPrivateKey: "",
              huifuDgPublicKey: "",
              huifuAdapayAppId: "",
              huifuAdapayMockApiKey: "",
              huifuAdapayProdApiKey: "",
              huifuAdapayRsaPrivateKey: "",
              huifuAdapayRsaPublicKey: "",
              huifuAdapayRsaTenantPublicKey: "",
            };
            that.aliMsg = {
              aliMsgAccessKeyId: "",
              aliMsgAccessKeySecret: "",
              aliMsgBindCardT: "",
              aliMsgChangeCardT: "",
              aliMsgDeleteCardT: "",
              aliMsgRegisterT: "",
              aliMsgForgetPasswordT: "",
              aliMsgChangeOldUserT: "",
              aliMsgChangeNewUserT: "",
              aliMsgVirtualT: "",
              aliMsgUrl: "",
              aliSignName: "",
            };
            that.$router.push("/sys/tenant");
          } else {
            that.$message.error("接口错误!请稍后再试");
          }
        });
      } else {
        arr = {
          tenantName: this.yuName.name,
          url: this.yuName.yName,
          wxXcxAppId: this.wxMini.wxMiniAppid,
          wxXcxSecret: this.wxMini.wxMiniSecret,
          wxMpSecret: this.wxMini.wxPubSecret,
          wxMpAppId: this.wxMini.wxPubAppid,
          wxMpLowBatMsgT: this.wxMini.wxMpLowBatMsgT,
          wxMpChargeMsgT: this.wxMini.wxMpChargeMsgT,
          wxMpToken: this.wxMini.token,
          wxMpAesKey: this.wxMini.aesKey,
          wxMpLongTimeMsgT: this.wxMini.wxMpLongTimeMsgT,
          wxMpMinusMsgT: this.wxMini.wxMpMinusMsgT,
          aliAppId: this.apMini.appid,
          aliPrivateKey: this.apMini.privateKey,
          aliPublicKey: this.apMini.publicKey,
          aliPublicAppKey: this.apMini.publicAppKey,
          aliAesKey: this.apMini.aesKey,
          huifuAdapayAppId: this.huifu.huifuAdapayAppId,
          huifuAdapayMockApiKey: this.huifu.huifuAdapayMockApiKey,
          huifuAdapayProdApiKey: this.huifu.huifuAdapayProdApiKey,
          huifuAdapayRsaPrivateKey: this.huifu.huifuAdapayRsaPrivateKey,
          huifuAdapayRsaPublicKey: this.huifu.huifuAdapayRsaPublicKey,
          huifuAdapayRsaTenantPublicKey:
            this.huifu.huifuAdapayRsaTenantPublicKey,
          aliMsgAccessKeyId: this.aliMsg.aliMsgAccessKeyId,
          aliMsgAccessKeySecret: this.aliMsg.aliMsgAccessKeySecret,
          aliMsgBindCardT: this.aliMsg.aliMsgBindCardT,
          aliMsgChangeCardT: this.aliMsg.aliMsgChangeCardT,
          aliMsgDeleteCardT: this.aliMsg.aliMsgDeleteCardT,
          aliMsgRegisterT: this.aliMsg.aliMsgRegisterT,
          aliMsgForgetPasswordT: this.aliMsg.aliMsgForgetPasswordT,
          aliMsgChangeOldUserT: this.aliMsg.aliMsgChangeOldUserT,
          aliMsgChangeNewUserT: this.aliMsg.aliMsgChangeNewUserT,
          aliMsgVirtualT: this.aliMsg.aliMsgVirtualT,
          aliMsgUrl: this.aliMsg.aliMsgUrl,
          aliSignName: this.aliMsg.aliSignName,
        };
        postTenantApApi(arr).then((res) => {
          if (res.code == 200) {
            that.$message.success("添加成功!");
            that.yuName = {
              name: "",
              yName: "",
            };
            that.wxMini = {
              wxMiniAppid: "",
              wxMiniSecret: "",
              wxMpLowBatMsgT: "",
              wxMpChargeMsgT: "",
              token: "",
              aesKey: "",
              wxPubAppid: "",
              wxPubSecret: "",
              wxMpLongTimeMsgT: "",
              wxMpMinusMsgT: "",
            };
            that.apMini = {
              appid: "",
              privateKey: "",
              publicKey: "",
              publicAppKey: "",
              aesKey: "",
            };
            that.huifu = {
              huifuType: 1,
              huifuDgSysId: "",
              huifuDgProductId: "",
              huifuDgPrivateKey: "",
              huifuDgPublicKey: "",
              huifuAdapayAppId: "",
              huifuAdapayMockApiKey: "",
              huifuAdapayProdApiKey: "",
              huifuAdapayRsaPrivateKey: "",
              huifuAdapayRsaPublicKey: "",
              huifuAdapayRsaTenantPublicKey: "",
            };
            that.aliMsg = {
              aliMsgAccessKeyId: "",
              aliMsgAccessKeySecret: "",
              aliMsgBindCardT: "",
              aliMsgChangeCardT: "",
              aliMsgDeleteCardT: "",
              aliMsgRegisterT: "",
              aliMsgForgetPasswordT: "",
              aliMsgChangeOldUserT: "",
              aliMsgChangeNewUserT: "",
              aliMsgVirtualT: "",
              aliMsgUrl: "",
              aliSignName: "",
            };
            that.$router.push("/sys/tenant");
          } else {
            that.$message.error("接口错误!请稍后再试");
          }
        });
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.dev {
  width: 100%;
  height: calc(100vh - 100px);
  padding: 0 25px;
  box-sizing: border-box;

  .step {
    z-index: 9;
    position: absolute;
    bottom: 5%;
    width: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-sizing: border-box;

    .el-steps {
      display: flex;
      justify-content: space-around;
      box-sizing: border-box;
      width: 60%;
    }
  }


  .aliyun {
    overflow-y: auto;
  }

  .title {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: flex-start;
    padding: 0 10px;
    margin-bottom: 10px;
  }

  .btn {
    width: 25%;
    display: flex;
    align-items: center;
    justify-content: center;

    .el-button {
      width: 100px;
    }
  }

  /deep/ .apl {
    width: 100%;

    .el-form {
      width: 100%;
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      align-content: center;

      .el-form-item {
        width: 45%;
      }
    }
  }

  .wx {
    width: 100%;
    display: flex;
    justify-content: space-between;

    .box-card {
      width: 48%;
      height: 100%;
    }
  }
}
</style>